<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class home extends CI_Controller {

    function __construct(){
        parent::__construct();
		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
		header("If-Modified-Since: Mon, 22 Jan 2008 00:00:00 GMT");
		header("Cache-Control: no-store, no-cache, must-revalidate");
		header("Cache-Control: post-check=0, pre-check=0", false);
		header("Cache-Control: private");
		header("Pragma: no-cache");
		$this->auth	= unserialize(base64_decode($this->session->userdata('sisfodealer')));
		$this->load->model(array('mhome','mdealer'));		
	}

	public function index(){
		if($this->auth){
			$data['module'] = "";
			$this->load->view('home', $data);
		}else{
			$data['pesan'] = "<font color='red'>anda harus login!</font>";
			$this->load->view('login',$data);
			return;
		}
	}
	
	function generaldisplay($parameter="", $parameter2=''){
		switch($parameter){
			case 'searchwindow':
				$type = $this->input->post('type');
				$type_window = $this->input->post('type_window');
				
				if($type_window == 'barang_bawah' || $type_window == 'barang_proc'){
					$data['nomernya'] = $this->input->post('nomer');
				}
				
				$data['parameter'] 	 = $parameter;
				$data['type_window'] = $type_window;
				$data['type'] 	  	 = $type;
				$this->load->view('windowsearch', $data);
			break;
			case 'getdatawindow':
				echo $this->mhome->getdata($parameter2);
			break;
			case 'autocomplete':
				//$keyword = $this->uri->segment(4);
				echo $this->mhome->getdata('autocomplete');
			break;
		}
	}
		
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */